From bd70721d8f999ad0e83c5841aa7582e2fdf05579 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20Davidovi=C4=87?= Date: Wed, 24 Dec 2014 03:45:46 +0100 Subject: [PATCH] Migrate to rustc-serialize As per rust-lang/rust@b04bc5c, move all Encodable and Decodable deriving modes to RustcEncodable and RustcDecodable, and also extern the rustc-serialize crate instead of the former serialize one. --- src/bin/bench.rs | 2 +- src/bin/build.rs | 2 +- src/bin/cargo.rs | 4 ++-- src/bin/clean.rs | 2 +- src/bin/config_for_key.rs | 4 ++-- src/bin/config_list.rs | 4 ++-- src/bin/doc.rs | 2 +- src/bin/fetch.rs | 2 +- src/bin/generate_lockfile.rs | 2 +- src/bin/git_checkout.rs | 2 +- src/bin/help.rs | 2 +- src/bin/locate_project.rs | 4 ++-- src/bin/login.rs | 2 +- src/bin/new.rs | 2 +- src/bin/owner.rs | 2 +- src/bin/package.rs | 2 +- src/bin/pkgid.rs | 2 +- src/bin/publish.rs | 2 +- src/bin/read_manifest.rs | 2 +- src/bin/run.rs | 2 +- src/bin/search.rs | 2 +- src/bin/test.rs | 2 +- src/bin/update.rs | 2 +- src/bin/verify_project.rs | 2 +- src/bin/version.rs | 2 +- src/bin/yank.rs | 2 +- src/cargo/core/dependency.rs | 2 +- src/cargo/core/manifest.rs | 12 ++++++------ src/cargo/core/package.rs | 4 ++-- src/cargo/core/package_id.rs | 4 ++-- src/cargo/core/resolver/encode.rs | 6 +++--- src/cargo/core/source.rs | 6 +++--- src/cargo/lib.rs | 5 +++-- src/cargo/ops/lockfile.rs | 2 +- src/cargo/sources/git/utils.rs | 12 ++++++------ src/cargo/sources/registry.rs | 10 +++++----- src/cargo/util/config.rs | 6 +++--- src/cargo/util/errors.rs | 2 +- src/cargo/util/hex.rs | 2 +- src/cargo/util/toml.rs | 24 ++++++++++++------------ src/registry/lib.rs | 25 +++++++++++++------------ tests/support/registry.rs | 2 +- 42 files changed, 93 insertions(+), 91 deletions(-) diff --git a/src/bin/bench.rs b/src/bin/bench.rs index 76eb81c91..5cefe978c 100644 --- a/src/bin/bench.rs +++ b/src/bin/bench.rs @@ -5,7 +5,7 @@ use cargo::core::MultiShell; use cargo::util::{CliResult, CliError, CargoError}; use cargo::util::important_paths::{find_root_manifest_for_cwd}; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct Options { flag_no_run: bool, flag_package: Option, diff --git a/src/bin/build.rs b/src/bin/build.rs index da0c1d4ee..edd100685 100644 --- a/src/bin/build.rs +++ b/src/bin/build.rs @@ -6,7 +6,7 @@ use cargo::ops; use cargo::util::important_paths::{find_root_manifest_for_cwd}; use cargo::util::{CliResult, CliError}; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct Options { flag_package: Option, flag_jobs: Option, diff --git a/src/bin/cargo.rs b/src/bin/cargo.rs index 64dbe5a64..9a96d6469 100644 --- a/src/bin/cargo.rs +++ b/src/bin/cargo.rs @@ -1,7 +1,7 @@ #![feature(phase, macro_rules)] #![deny(warnings)] -extern crate serialize; +extern crate "rustc-serialize" as rustc_serialize; #[phase(plugin, link)] extern crate log; #[phase(plugin, link)] extern crate cargo; @@ -15,7 +15,7 @@ use cargo::{execute_main_without_stdin, handle_error, shell}; use cargo::core::MultiShell; use cargo::util::{CliError, CliResult}; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct Flags { flag_list: bool, flag_verbose: bool, diff --git a/src/bin/clean.rs b/src/bin/clean.rs index 09258b068..56c9cfcb8 100644 --- a/src/bin/clean.rs +++ b/src/bin/clean.rs @@ -5,7 +5,7 @@ use cargo::core::MultiShell; use cargo::util::{CliResult, CliError}; use cargo::util::important_paths::{find_root_manifest_for_cwd}; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct Options { flag_package: Option, flag_target: Option, diff --git a/src/bin/config_for_key.rs b/src/bin/config_for_key.rs index f1092c83e..03ee07210 100644 --- a/src/bin/config_for_key.rs +++ b/src/bin/config_for_key.rs @@ -4,13 +4,13 @@ use std::collections::HashMap; use cargo::core::MultiShell; use cargo::util::{CliResult, CliError, config}; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct ConfigForKeyFlags { flag_human: bool, flag_key: String, } -#[deriving(Encodable)] +#[deriving(RustcEncodable)] struct ConfigOut { values: HashMap } diff --git a/src/bin/config_list.rs b/src/bin/config_list.rs index 336bad08f..e7659f51a 100644 --- a/src/bin/config_list.rs +++ b/src/bin/config_list.rs @@ -4,12 +4,12 @@ use std::collections::HashMap; use cargo::core::MultiShell; use cargo::util::{CliResult, CliError, config}; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct ConfigListFlags { flag_human: bool, } -#[deriving(Encodable)] +#[deriving(RustcEncodable)] struct ConfigOut { values: HashMap } diff --git a/src/bin/doc.rs b/src/bin/doc.rs index 6e835ed51..78be47183 100644 --- a/src/bin/doc.rs +++ b/src/bin/doc.rs @@ -3,7 +3,7 @@ use cargo::core::{MultiShell}; use cargo::util::{CliResult, CliError}; use cargo::util::important_paths::{find_root_manifest_for_cwd}; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct Options { flag_features: Vec, flag_jobs: Option, diff --git a/src/bin/fetch.rs b/src/bin/fetch.rs index 837abd97f..96adca0ba 100644 --- a/src/bin/fetch.rs +++ b/src/bin/fetch.rs @@ -3,7 +3,7 @@ use cargo::core::{MultiShell}; use cargo::util::{CliResult, CliError}; use cargo::util::important_paths::find_root_manifest_for_cwd; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct Options { flag_manifest_path: Option, flag_verbose: bool, diff --git a/src/bin/generate_lockfile.rs b/src/bin/generate_lockfile.rs index 0570f2464..cc4426038 100644 --- a/src/bin/generate_lockfile.rs +++ b/src/bin/generate_lockfile.rs @@ -5,7 +5,7 @@ use cargo::core::MultiShell; use cargo::util::{CliResult, CliError}; use cargo::util::important_paths::find_root_manifest_for_cwd; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct Options { flag_manifest_path: Option, flag_verbose: bool, diff --git a/src/bin/git_checkout.rs b/src/bin/git_checkout.rs index a42cbbd03..184da359f 100644 --- a/src/bin/git_checkout.rs +++ b/src/bin/git_checkout.rs @@ -3,7 +3,7 @@ use cargo::core::source::{Source, SourceId}; use cargo::sources::git::{GitSource}; use cargo::util::{Config, CliResult, CliError, human, ToUrl}; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct Options { flag_url: String, flag_reference: String, diff --git a/src/bin/help.rs b/src/bin/help.rs index 492deca72..d57415b5b 100644 --- a/src/bin/help.rs +++ b/src/bin/help.rs @@ -1,7 +1,7 @@ use cargo::core::MultiShell; use cargo::util::{CliResult, CliError}; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct Options; pub const USAGE: &'static str = " diff --git a/src/bin/locate_project.rs b/src/bin/locate_project.rs index 2013977e9..dfa6ec5e5 100644 --- a/src/bin/locate_project.rs +++ b/src/bin/locate_project.rs @@ -2,7 +2,7 @@ use cargo::core::MultiShell; use cargo::util::{CliResult, CliError, human, Require}; use cargo::util::important_paths::{find_root_manifest_for_cwd}; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct LocateProjectFlags { flag_manifest_path: Option, } @@ -16,7 +16,7 @@ Options: -h, --help Print this message "; -#[deriving(Encodable)] +#[deriving(RustcEncodable)] struct ProjectLocation { root: String } diff --git a/src/bin/login.rs b/src/bin/login.rs index 7e9a3c9a1..0310f9086 100644 --- a/src/bin/login.rs +++ b/src/bin/login.rs @@ -5,7 +5,7 @@ use cargo::core::{MultiShell, SourceId, Source}; use cargo::sources::RegistrySource; use cargo::util::{CliResult, CliError, Config}; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct Options { flag_host: Option, arg_token: Option, diff --git a/src/bin/new.rs b/src/bin/new.rs index 46416c09b..80f6c5999 100644 --- a/src/bin/new.rs +++ b/src/bin/new.rs @@ -4,7 +4,7 @@ use cargo::ops; use cargo::core::MultiShell; use cargo::util::{CliResult, CliError}; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct Options { flag_verbose: bool, flag_bin: bool, diff --git a/src/bin/owner.rs b/src/bin/owner.rs index 4aabdb9f7..a4cf36f65 100644 --- a/src/bin/owner.rs +++ b/src/bin/owner.rs @@ -2,7 +2,7 @@ use cargo::ops; use cargo::core::MultiShell; use cargo::util::{CliResult, CliError}; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct Options { arg_crate: Option, flag_token: Option, diff --git a/src/bin/package.rs b/src/bin/package.rs index 057d5c90f..dbc91e42c 100644 --- a/src/bin/package.rs +++ b/src/bin/package.rs @@ -3,7 +3,7 @@ use cargo::core::{MultiShell}; use cargo::util::{CliResult, CliError}; use cargo::util::important_paths::find_root_manifest_for_cwd; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct Options { flag_verbose: bool, flag_manifest_path: Option, diff --git a/src/bin/pkgid.rs b/src/bin/pkgid.rs index b126462aa..8cb91e0ae 100644 --- a/src/bin/pkgid.rs +++ b/src/bin/pkgid.rs @@ -3,7 +3,7 @@ use cargo::core::MultiShell; use cargo::util::{CliResult, CliError}; use cargo::util::important_paths::{find_root_manifest_for_cwd}; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct Options { flag_verbose: bool, flag_manifest_path: Option, diff --git a/src/bin/publish.rs b/src/bin/publish.rs index 54bc57d32..07e1625de 100644 --- a/src/bin/publish.rs +++ b/src/bin/publish.rs @@ -3,7 +3,7 @@ use cargo::core::{MultiShell}; use cargo::util::{CliResult, CliError}; use cargo::util::important_paths::find_root_manifest_for_cwd; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct Options { flag_host: Option, flag_token: Option, diff --git a/src/bin/read_manifest.rs b/src/bin/read_manifest.rs index ea2fe2204..03a85f850 100644 --- a/src/bin/read_manifest.rs +++ b/src/bin/read_manifest.rs @@ -2,7 +2,7 @@ use cargo::core::{MultiShell, Package, Source}; use cargo::util::{CliResult, CliError}; use cargo::sources::{PathSource}; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct Options { flag_manifest_path: String, } diff --git a/src/bin/run.rs b/src/bin/run.rs index 98fde6e09..29265d49d 100644 --- a/src/bin/run.rs +++ b/src/bin/run.rs @@ -6,7 +6,7 @@ use cargo::core::manifest::TargetKind; use cargo::util::{CliResult, CliError, human}; use cargo::util::important_paths::{find_root_manifest_for_cwd}; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct Options { flag_bin: Option, flag_example: Option, diff --git a/src/bin/search.rs b/src/bin/search.rs index 95d01bc30..706100112 100644 --- a/src/bin/search.rs +++ b/src/bin/search.rs @@ -2,7 +2,7 @@ use cargo::ops; use cargo::core::{MultiShell}; use cargo::util::{CliResult, CliError}; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct Options { flag_host: Option, flag_verbose: bool, diff --git a/src/bin/test.rs b/src/bin/test.rs index bcae35f2a..15b517a4f 100644 --- a/src/bin/test.rs +++ b/src/bin/test.rs @@ -5,7 +5,7 @@ use cargo::core::MultiShell; use cargo::util::{CliResult, CliError, CargoError}; use cargo::util::important_paths::{find_root_manifest_for_cwd}; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct Options { arg_args: Vec, flag_features: Vec, diff --git a/src/bin/update.rs b/src/bin/update.rs index fdcb1c57a..47596ba74 100644 --- a/src/bin/update.rs +++ b/src/bin/update.rs @@ -5,7 +5,7 @@ use cargo::core::MultiShell; use cargo::util::{CliResult, CliError}; use cargo::util::important_paths::find_root_manifest_for_cwd; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct Options { arg_spec: Option, flag_package: Option, diff --git a/src/bin/verify_project.rs b/src/bin/verify_project.rs index 06dab62e1..4bd04adfa 100644 --- a/src/bin/verify_project.rs +++ b/src/bin/verify_project.rs @@ -9,7 +9,7 @@ use cargo::util::CliResult; pub type Error = HashMap; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct Flags { flag_manifest_path: String, flag_verbose: bool, diff --git a/src/bin/version.rs b/src/bin/version.rs index 68bb46a31..02fcb0cff 100644 --- a/src/bin/version.rs +++ b/src/bin/version.rs @@ -4,7 +4,7 @@ use cargo; use cargo::core::MultiShell; use cargo::util::CliResult; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct Options; pub const USAGE: &'static str = " diff --git a/src/bin/yank.rs b/src/bin/yank.rs index f3dc4fd65..2103f69c8 100644 --- a/src/bin/yank.rs +++ b/src/bin/yank.rs @@ -3,7 +3,7 @@ use cargo::core::MultiShell; use cargo::util::{CliResult, CliError}; use cargo::util::important_paths::find_root_manifest_for_cwd; -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct Options { arg_crate: Option, flag_token: Option, diff --git a/src/cargo/core/dependency.rs b/src/cargo/core/dependency.rs index 67c8a0a02..76e9f97c6 100644 --- a/src/cargo/core/dependency.rs +++ b/src/cargo/core/dependency.rs @@ -184,7 +184,7 @@ impl Dependency { } } -#[deriving(PartialEq,Clone,Encodable)] +#[deriving(PartialEq,Clone,RustcEncodable)] pub struct SerializedDependency { name: String, req: String diff --git a/src/cargo/core/manifest.rs b/src/cargo/core/manifest.rs index 51c16ff27..2953001a7 100644 --- a/src/cargo/core/manifest.rs +++ b/src/cargo/core/manifest.rs @@ -2,7 +2,7 @@ use std::hash; use std::fmt::{mod, Show, Formatter}; use semver::Version; -use serialize::{Encoder,Encodable}; +use rustc_serialize::{Encoder,Encodable}; use core::{Dependency, PackageId, Summary}; use core::package_id::Metadata; @@ -53,7 +53,7 @@ pub struct ManifestMetadata { pub documentation: Option, // url } -#[deriving(PartialEq,Clone,Encodable)] +#[deriving(PartialEq,Clone,RustcEncodable)] pub struct SerializedManifest { name: String, version: String, @@ -81,7 +81,7 @@ impl> Encodable for Manifest { } } -#[deriving(Show, Clone, PartialEq, Hash, Encodable, Copy)] +#[deriving(Show, Clone, PartialEq, Hash, RustcEncodable, Copy)] pub enum LibKind { Lib, Rlib, @@ -116,14 +116,14 @@ impl LibKind { } } -#[deriving(Show, Clone, Hash, PartialEq, Encodable)] +#[deriving(Show, Clone, Hash, PartialEq, RustcEncodable)] pub enum TargetKind { Lib(Vec), Bin, Example, } -#[deriving(Encodable, Decodable, Clone, PartialEq, Show)] +#[deriving(RustcEncodable, RustcDecodable, Clone, PartialEq, Show)] pub struct Profile { env: String, // compile, test, dev, bench, etc. opt_level: uint, @@ -360,7 +360,7 @@ pub struct Target { metadata: Option, } -#[deriving(Encodable)] +#[deriving(RustcEncodable)] pub struct SerializedTarget { kind: Vec<&'static str>, name: String, diff --git a/src/cargo/core/package.rs b/src/cargo/core/package.rs index 594f685cb..d7e732c9c 100644 --- a/src/cargo/core/package.rs +++ b/src/cargo/core/package.rs @@ -13,7 +13,7 @@ use core::{ }; use core::dependency::SerializedDependency; use util::{CargoResult, graph}; -use serialize::{Encoder,Encodable}; +use rustc_serialize::{Encoder,Encodable}; use core::source::{SourceId, Source}; /// Informations about a package that is available somewhere in the file system. @@ -30,7 +30,7 @@ pub struct Package { source_id: SourceId, } -#[deriving(Encodable)] +#[deriving(RustcEncodable)] struct SerializedPackage { name: String, version: String, diff --git a/src/cargo/core/package_id.rs b/src/cargo/core/package_id.rs index f763d8ccc..acb341131 100644 --- a/src/cargo/core/package_id.rs +++ b/src/cargo/core/package_id.rs @@ -3,7 +3,7 @@ use std::hash::Hash; use std::sync::Arc; use std::fmt::{mod, Show, Formatter}; use std::hash; -use serialize::{Encodable, Encoder, Decodable, Decoder}; +use rustc_serialize::{Encodable, Encoder, Decodable, Decoder}; use regex::Regex; @@ -99,7 +99,7 @@ impl CargoError for PackageIdError { fn is_human(&self) -> bool { true } } -#[deriving(PartialEq, Hash, Clone, Encodable)] +#[deriving(PartialEq, Hash, Clone, RustcEncodable)] pub struct Metadata { pub metadata: String, pub extra_filename: String diff --git a/src/cargo/core/resolver/encode.rs b/src/cargo/core/resolver/encode.rs index cd12897e6..47bb005d7 100644 --- a/src/cargo/core/resolver/encode.rs +++ b/src/cargo/core/resolver/encode.rs @@ -1,14 +1,14 @@ use std::collections::{HashMap, BTreeMap}; use regex::Regex; -use serialize::{Encodable, Encoder, Decodable, Decoder}; +use rustc_serialize::{Encodable, Encoder, Decodable, Decoder}; use core::{PackageId, SourceId}; use util::{CargoResult, Graph}; use super::Resolve; -#[deriving(Encodable, Decodable, Show)] +#[deriving(RustcEncodable, RustcDecodable, Show)] pub struct EncodableResolve { package: Option>, root: EncodableDependency, @@ -76,7 +76,7 @@ impl EncodableResolve { } } -#[deriving(Encodable, Decodable, Show, PartialOrd, Ord, PartialEq, Eq)] +#[deriving(RustcEncodable, RustcDecodable, Show, PartialOrd, Ord, PartialEq, Eq)] pub struct EncodableDependency { name: String, version: String, diff --git a/src/cargo/core/source.rs b/src/cargo/core/source.rs index e2347b19d..5dbd498ea 100644 --- a/src/cargo/core/source.rs +++ b/src/cargo/core/source.rs @@ -1,9 +1,9 @@ -use std::collections::hash_map::{HashMap, Values, MutEntries}; +use std::collections::hash_map::{HashMap, Values, IterMut}; use std::fmt::{mod, Show, Formatter}; use std::hash; use std::mem; use std::sync::Arc; -use serialize::{Decodable, Decoder, Encodable, Encoder}; +use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; use url::Url; @@ -42,7 +42,7 @@ pub trait Source: Registry { fn fingerprint(&self, pkg: &Package) -> CargoResult; } -#[deriving(Encodable, Decodable, Show, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[deriving(RustcEncodable, RustcDecodable, Show, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] enum Kind { /// Kind::Git() represents a git repository Git(String), diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs index 360e32790..f277cd6a0 100644 --- a/src/cargo/lib.rs +++ b/src/cargo/lib.rs @@ -7,8 +7,8 @@ #![cfg_attr(test, deny(warnings))] extern crate libc; +extern crate "rustc-serialize" as rustc_serialize; extern crate regex; -extern crate serialize; extern crate term; extern crate time; #[phase(plugin, link)] extern crate log; @@ -29,7 +29,8 @@ extern crate registry; use std::os; use std::io::stdio::{stdout_raw, stderr_raw}; use std::io::{mod, stdout, stderr}; -use serialize::{Decoder, Encoder, Decodable, Encodable, json}; +use rustc_serialize::{Decoder, Encoder, Decodable, Encodable}; +use rustc_serialize::json; use docopt::Docopt; use core::{Shell, MultiShell, ShellConfig}; diff --git a/src/cargo/ops/lockfile.rs b/src/cargo/ops/lockfile.rs index 5b914e4f1..b5a8414b0 100644 --- a/src/cargo/ops/lockfile.rs +++ b/src/cargo/ops/lockfile.rs @@ -1,6 +1,6 @@ use std::io::File; -use serialize::{Encodable, Decodable}; +use rustc_serialize::{Encodable, Decodable}; use toml::{mod, Encoder, Value}; use core::{Resolve, resolver, Package, SourceId}; diff --git a/src/cargo/sources/git/utils.rs b/src/cargo/sources/git/utils.rs index 5631af7f4..0e7b3afed 100644 --- a/src/cargo/sources/git/utils.rs +++ b/src/cargo/sources/git/utils.rs @@ -1,19 +1,19 @@ use std::fmt::{mod, Show, Formatter}; use std::io::{USER_DIR}; use std::io::fs::{mkdir_recursive, rmdir_recursive, PathExtensions}; -use serialize::{Encodable, Encoder}; +use rustc_serialize::{Encodable, Encoder}; use url::Url; use git2; use util::{CargoResult, ChainError, human, ToUrl, internal, Require}; -#[deriving(PartialEq,Clone,Encodable)] +#[deriving(PartialEq,Clone,RustcEncodable)] pub enum GitReference { Master, Other(String) } -#[deriving(PartialEq,Clone,Encodable)] +#[deriving(PartialEq,Clone,RustcEncodable)] pub struct GitRevision(String); impl GitReference { @@ -61,7 +61,7 @@ pub struct GitRemote { url: Url, } -#[deriving(PartialEq,Clone,Encodable)] +#[deriving(PartialEq,Clone,RustcEncodable)] struct EncodableGitRemote { url: String, } @@ -82,7 +82,7 @@ pub struct GitDatabase { repo: git2::Repository, } -#[deriving(Encodable)] +#[deriving(RustcEncodable)] pub struct EncodableGitDatabase { remote: GitRemote, path: String, @@ -107,7 +107,7 @@ pub struct GitCheckout<'a> { repo: git2::Repository, } -#[deriving(Encodable)] +#[deriving(RustcEncodable)] pub struct EncodableGitCheckout { database: EncodableGitDatabase, location: String, diff --git a/src/cargo/sources/registry.rs b/src/cargo/sources/registry.rs index 6566b88fb..c42a41c2d 100644 --- a/src/cargo/sources/registry.rs +++ b/src/cargo/sources/registry.rs @@ -165,8 +165,8 @@ use std::collections::HashMap; use curl::http; use git2; use flate2::reader::GzDecoder; -use serialize::json; -use serialize::hex::ToHex; +use rustc_serialize::json; +use rustc_serialize::hex::ToHex; use tar::Archive; use url::Url; @@ -192,7 +192,7 @@ pub struct RegistrySource<'a, 'b:'a> { updated: bool, } -#[deriving(Decodable)] +#[deriving(RustcDecodable)] pub struct RegistryConfig { /// Download endpoint for all crates. This will be appended with /// `///download` and then will be hit with an HTTP GET @@ -204,7 +204,7 @@ pub struct RegistryConfig { pub api: String, } -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct RegistryPackage { name: String, vers: String, @@ -214,7 +214,7 @@ struct RegistryPackage { yanked: Option, } -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct RegistryDependency { name: String, req: String, diff --git a/src/cargo/util/config.rs b/src/cargo/util/config.rs index 8d000b641..27fa2c1d7 100644 --- a/src/cargo/util/config.rs +++ b/src/cargo/util/config.rs @@ -6,7 +6,7 @@ use std::io; use std::io::fs::{mod, PathExtensions, File}; use std::string; -use serialize::{Encodable,Encoder}; +use rustc_serialize::{Encodable,Encoder}; use toml; use core::MultiShell; use ops; @@ -94,13 +94,13 @@ impl<'a> Config<'a> { } } -#[deriving(Eq, PartialEq, Clone, Encodable, Decodable, Copy)] +#[deriving(Eq, PartialEq, Clone, RustcEncodable, RustcDecodable, Copy)] pub enum Location { Project, Global } -#[deriving(Eq,PartialEq,Clone,Decodable)] +#[deriving(Eq,PartialEq,Clone,RustcDecodable)] pub enum ConfigValue { String(string::String, Path), List(Vec<(string::String, Path)>), diff --git a/src/cargo/util/errors.rs b/src/cargo/util/errors.rs index 32fcf1e87..c33b7f1a7 100644 --- a/src/cargo/util/errors.rs +++ b/src/cargo/util/errors.rs @@ -2,7 +2,7 @@ use std::io::process::{ProcessOutput, ProcessExit, ExitStatus, ExitSignal}; use std::io::IoError; use std::fmt::{mod, Show, Formatter}; use std::str; -use serialize::json; +use rustc_serialize::json; use semver; use curl; diff --git a/src/cargo/util/hex.rs b/src/cargo/util/hex.rs index dc1f9d611..005dac91e 100644 --- a/src/cargo/util/hex.rs +++ b/src/cargo/util/hex.rs @@ -2,7 +2,7 @@ use std::io::MemWriter; use std::hash::{Hasher, Hash}; use std::hash::sip::SipHasher; -use serialize::hex::ToHex; +use rustc_serialize::hex::ToHex; pub fn to_hex(num: u64) -> String { let mut writer = MemWriter::with_capacity(8); diff --git a/src/cargo/util/toml.rs b/src/cargo/util/toml.rs index 762e32d13..a74cb1d80 100644 --- a/src/cargo/util/toml.rs +++ b/src/cargo/util/toml.rs @@ -7,7 +7,7 @@ use std::str; use std::default::Default; use toml; use semver; -use serialize::{Decodable, Decoder}; +use rustc_serialize::{Decodable, Decoder}; use core::SourceId; use core::{Summary, Manifest, Target, Dependency, PackageId}; @@ -181,14 +181,14 @@ type TomlBenchTarget = TomlTarget; * TODO: Make all struct fields private */ -#[deriving(Decodable)] +#[deriving(RustcDecodable)] pub enum TomlDependency { Simple(String), Detailed(DetailedTomlDependency) } -#[deriving(Decodable, Clone, Default)] +#[deriving(RustcDecodable, Clone, Default)] pub struct DetailedTomlDependency { version: Option, path: Option, @@ -201,7 +201,7 @@ pub struct DetailedTomlDependency { default_features: Option, } -#[deriving(Decodable)] +#[deriving(RustcDecodable)] pub struct TomlManifest { package: Option>, project: Option>, @@ -218,7 +218,7 @@ pub struct TomlManifest { target: Option>, } -#[deriving(Decodable, Clone, Default)] +#[deriving(RustcDecodable, Clone, Default)] pub struct TomlProfiles { test: Option, doc: Option, @@ -227,7 +227,7 @@ pub struct TomlProfiles { release: Option, } -#[deriving(Decodable, Clone, Default)] +#[deriving(RustcDecodable, Clone, Default)] #[allow(missing_copy_implementations)] pub struct TomlProfile { opt_level: Option, @@ -237,7 +237,7 @@ pub struct TomlProfile { rpath: Option, } -#[deriving(Decodable)] +#[deriving(RustcDecodable)] pub enum ManyOrOne { Many(Vec), One(T), @@ -252,7 +252,7 @@ impl ManyOrOne { } } -#[deriving(Decodable)] +#[deriving(RustcDecodable)] pub struct TomlProject { name: String, version: TomlVersion, @@ -273,7 +273,7 @@ pub struct TomlProject { } // TODO: deprecated, remove -#[deriving(Decodable)] +#[deriving(RustcDecodable)] pub enum BuildCommand { Single(String), Multiple(Vec) @@ -604,7 +604,7 @@ fn process_dependencies<'a>(cx: &mut Context<'a>, Ok(()) } -#[deriving(Decodable, Show, Clone)] +#[deriving(RustcDecodable, Show, Clone)] struct TomlTarget { name: String, crate_type: Option>, @@ -617,14 +617,14 @@ struct TomlTarget { harness: Option, } -#[deriving(Decodable, Clone)] +#[deriving(RustcDecodable, Clone)] enum PathValue { String(String), Path(Path), } /// Corresponds to a `target` entry, but `TomlTarget` is already used. -#[deriving(Decodable)] +#[deriving(RustcDecodable)] struct TomlPlatform { dependencies: Option>, } diff --git a/src/registry/lib.rs b/src/registry/lib.rs index d87576808..75cc5a6d2 100644 --- a/src/registry/lib.rs +++ b/src/registry/lib.rs @@ -1,5 +1,5 @@ extern crate curl; -extern crate serialize; +extern crate "rustc-serialize" as rustc_serialize; use std::fmt; use std::io::{mod, fs, MemReader, MemWriter, File}; @@ -10,7 +10,8 @@ use std::result; use curl::http; use curl::http::handle::Method::{Put, Get, Delete}; use curl::http::handle::{Method, Request}; -use serialize::json; +use rustc_serialize::json; + pub struct Registry { host: String, @@ -36,14 +37,14 @@ pub enum Error { Io(io::IoError), } -#[deriving(Decodable)] +#[deriving(RustcDecodable)] pub struct Crate { pub name: String, pub description: Option, pub max_version: String } -#[deriving(Encodable)] +#[deriving(RustcEncodable)] pub struct NewCrate { pub name: String, pub vers: String, @@ -60,7 +61,7 @@ pub struct NewCrate { pub repository: Option, } -#[deriving(Encodable)] +#[deriving(RustcEncodable)] pub struct NewCrateDependency { pub optional: bool, pub default_features: bool, @@ -71,7 +72,7 @@ pub struct NewCrateDependency { pub kind: String, } -#[deriving(Decodable)] +#[deriving(RustcDecodable)] pub struct User { pub id: uint, pub login: String, @@ -80,12 +81,12 @@ pub struct User { pub name: Option, } -#[deriving(Decodable)] struct R { ok: bool } -#[deriving(Decodable)] struct ApiErrorList { errors: Vec } -#[deriving(Decodable)] struct ApiError { detail: String } -#[deriving(Encodable)] struct OwnersReq<'a> { users: &'a [&'a str] } -#[deriving(Decodable)] struct Users { users: Vec } -#[deriving(Decodable)] struct Crates { crates: Vec } +#[deriving(RustcDecodable)] struct R { ok: bool } +#[deriving(RustcDecodable)] struct ApiErrorList { errors: Vec } +#[deriving(RustcDecodable)] struct ApiError { detail: String } +#[deriving(RustcEncodable)] struct OwnersReq<'a> { users: &'a [&'a str] } +#[deriving(RustcDecodable)] struct Users { users: Vec } +#[deriving(RustcDecodable)] struct Crates { crates: Vec } impl Registry { pub fn new(host: String, token: Option) -> Registry { diff --git a/tests/support/registry.rs b/tests/support/registry.rs index 3fd6cf091..3fac53dcb 100644 --- a/tests/support/registry.rs +++ b/tests/support/registry.rs @@ -3,7 +3,7 @@ use std::io::{mod, fs, File}; use flate2::CompressionLevel::Default; use flate2::writer::GzEncoder; use git2; -use serialize::hex::ToHex; +use rustc_serialize::hex::ToHex; use tar::Archive; use url::Url; -- 2.30.2